package com.youpai.platform.order.web.api;

import com.youpai.platform.common.entity.resp.BaseResponse;
import com.youpai.platform.order.service.service.OrderEvaluateService;
import com.youpai.platform.order.web.entity.dto.EvaluateDto;
import com.youpai.platform.order.web.entity.req.CreateEvaluateReq;
import com.youpai.platform.order.web.entity.req.ListEvaluateReq;
import com.youpai.platform.order.web.entity.req.RemoveEvaluateReq;
import com.youpai.platform.order.web.entity.resp.EvaluateResp;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping(value = "/order/evaluate")
@Api(value = "OrderEvaluateController", tags = "订单评价controller")
public class OrderEvaluateController {

    @Resource
    private OrderEvaluateService orderEvaluateService;

    @ApiOperation(value = "创建订单评价")
    @PostMapping(value = "/create")
    public BaseResponse<EvaluateResp> createEvaluate(@RequestBody CreateEvaluateReq req) {
        return BaseResponse.success(orderEvaluateService.createEvaluate(req));
    }

    @ApiOperation(value = "获取评价列表")
    @PostMapping(value = "/list")
    public BaseResponse<List<EvaluateDto>> listEvaluate(@RequestBody ListEvaluateReq req) {
        return BaseResponse.success(orderEvaluateService.listEvaluate(req));
    }

    @ApiOperation(value = "删除评价")
    @PostMapping(value = "/remove")
    public BaseResponse<EvaluateResp> removeEvaluate(@RequestBody RemoveEvaluateReq req) {
        return BaseResponse.success(orderEvaluateService.removeEvaluate(req));
    }

}
